//
//  HerosStroyTableViewCell.m
//  LOLBOX
//
//  Created by lanou3g on 15/12/18.
//  Copyright © 2015年 张明. All rights reserved.
//

#import "HerosStroyTableViewCell.h"

@implementation HerosStroyTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self p_setView];
    }
    return self;
}


-(void)p_setView{
    self.headImageView = [[UIImageView alloc] init];
    self.headImageView.frame = CGRectMake(10, 5, 40, 40);
    self.headImageView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.headImageView];
    
    self.contentLable = [[UILabel alloc] init];
    self.contentLable.frame = CGRectMake(55, 5, self.frame.size.width - 60, 40);
    self.contentLable.backgroundColor = [UIColor whiteColor];
    self.contentLable.font = [UIFont systemFontOfSize:14];
    self.contentLable.numberOfLines = 0;
    [self addSubview:self.contentLable];
}

-(void)layoutSubviews{
    [super layoutSubviews];
    self.headImageView.frame = CGRectMake(10, 5, 40, 40);
    
    // self.contentLable.frame = CGRectMake(55, 0, self.frame.size.width - 60, self.frame.size.height);
    self.contentLable.frame = CGRectMake(55, 5, self.frame.size.width-60, self.height);
    
}

-(CGFloat)getHeightWithString:(NSString *)string{
    CGRect rect = [string boundingRectWithSize:CGSizeMake(self.frame.size.width - 60, 2000) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName :[UIFont systemFontOfSize:14.0]} context:nil];
    
    self.height = rect.size.height;
    
    return rect.size.height;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}


@end
